public class test {
    class Solution {
        List<List<Integer>> res;
        List<Integer> list;
        public List<List<Integer>> findSubsequences(int[] nums) {
            res = new ArrayList<>();
            list = new ArrayList<>();
            backTracking(nums,0);
            return res;
        }
        private void backTracking(int[] nums,int start){
            if(list.size()>=2){
                res.add(new ArrayList(list));
            }
            HashSet<Integer> set = new HashSet<>();
            for(int i = start;i<nums.length;i++){
                if(!list.isEmpty()&&nums[i]<list.getLast() || set.contains(nums[i])){
                    continue;
                }
                list.add(nums[i]);
                set.add(nums[i]);
                backTracking(nums,i+1);
                list.removeLast();
            }
        }
    }
}
